package com.example.demo;

import com.alibaba.fastjson.JSON;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/demo")
public class DeomController {

    @RequestMapping("/hello.do")
    public String hello(HttpServletRequest request, HttpServletResponse response) {
        String loginName = request.getParameter("loginName");
        String password = request.getParameter("password");
        if(loginName!=null&&password!=null&&loginName.equals("kai.yang")&&password.equals("kai.yang")){
            ResultVo vo= new ResultVo("1", "成功");
            return JSON.toJSONString(vo);
        }else{
            return  JSON.toJSONString(new ResultVo("2","用户名密码错误!"));
        }
    }
}
